import { Controller,Get,Put,Post,Param,Body,ParseUUIDPipe } from '@nestjs/common';
import { FindStudentResponseDto,StudentResponseDto } from '../student/dto/student.dto';
import { StudentService } from '../student/student.service';
@Controller('teacher/:teacherId/students')
export class StudentTeacherController {
    constructor( private readonly studentService:StudentService){
    }

    @Get()
    getStudents(
        @Param('teacherId', new ParseUUIDPipe()) teacherId:string
    ):FindStudentResponseDto[]{
        return  this.studentService.getStudentsByTeacherId(teacherId)
    }
   
    @Post()
     createStudent(
        @Body() body
     ):FindStudentResponseDto{
        return  this.studentService.createStudent(body)
     }

    @Put('/:studentId')
    updateStudentTeacher(
        @Param('teacherId', new ParseUUIDPipe()) teacherId:string,
        @Param('studentId',new ParseUUIDPipe()) studentId:string
    ):StudentResponseDto{
          return this.studentService.updateStudentTeacher(teacherId,studentId)
    }

}
